<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>[|.pageTitle|]</title>
    [|if .zTree|]
    <link rel="stylesheet" href="/static/zTree3/css/demo.css?t=5" type="text/css">
    <link rel="stylesheet" href="/static/zTree3/css/zTreeStyle/zTreeStyle.css" type="text/css">
    [|end|]
    <meta charset="utf-8">
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/css/main.css">
    <script src="/static/layui/layui.js?s=36"></script>
    <script src="/static/js/main.js?s=2124"></script>
    <script src="/static/js/echarts.js"></script>
</head>
<body>
<div class="layui-layout layui-layout-admin" style="margin-top: 20px; align:left;">
    <form class="layui-form" >
        <div class="layui-input-inline">
            <div class="layui-inline">
                <label class="layui-form-label" >管理员：</label>
                <div class="layui-input-inline" >
                    <input type="text" class="layui-input" id="GMUserName" lay-verify="" style="width:100px">
                </div>
            </div>
            <div class="layui-inline">
                 <div class="layui-input-inline" style="width:100px" >
                    <select  name = "isabnormal" id = "isabnormal" lay-verify=""   readonly>
                        <option value="1">推广号</option>
                        <option value="2">USERID</option>
                        <option value="3">玩家昵称</option>
                    </select>
                </div>
                <div class="layui-input-inline" >
                    <input type="text" class="layui-input" id="UserGameID" lay-verify="" style="width:100px">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">操作时间：</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="BeforDateTime" placeholder="" style="width:150px" readonly>
                </div>
                <label>-</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="AfterDateTime" placeholder="" style="width:150px" readonly>
                </div>
            </div>
       
            <div class="layui-inline">
                <label class="layui-form-label">邮件状态：</label>
                <div class="layui-input-inline" style="width:100px" >
                    <select name = "userWinLose" id = "userWinLose" lay-verify="" readonly>
                        <option value="">-请选择-</option>
                        <option value="0">未发送</option>
                        <option value="1">已发送</option>
                        <option value="2">已领取</option>
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="starquery">开始查询</button>
            </div>
        </div> 
        
        <br />
        <hr class="layui-bg-gray">
        <div>
            <p>
                <label id="" style="color:rgb(0, 0, 0);">邮件总金币：</label>
                <label id="UserData1" style="color:red;">0</label>
                <label id="" style="color:rgb(0, 0, 0);">,邮件数量：</label>
                <label id="UserData2" style="color:red;">0</label>
            </p>
        </div>

    </form>


    <table  class="layui-table" id="userinfotable" lay-size="sm" lay-filter="layfilteruserinfotable"> </table> 

</div>
<script>
    var $;

    layui.config({
            base : "js/"
    }).use(['form','element','layer','jquery','table','laydate'], function(){
        var table = layui.table;
        var element = layui.element;
        var form = layui.form;
        var laydate = layui.laydate;
        $ = layui.jquery;
    //监听表格复选框选择
   // table.on('checkbox(demo)', function(obj){
    //   console.log(obj);
   // });

    //监听工具条
      laydate.render({
        elem: '#BeforDateTime'
        ,type: 'datetime'
      });
    laydate.render({
        elem: '#AfterDateTime'
       ,type: 'datetime'
    });
    ShowTablesDatas(table)
    form.on('submit(starquery)', function(data) {
         
      ShowTablesDatas(table)    
     return false;
    });

    //监听单元格事件
   // table.on('tool(layfilteruserinfotable)', function(obj){
     //   var data = obj.data;
     //   if(obj.event === 'UserInfo'){
      //      window.location.href="/usersfinduser/userinfopage.html?UserID=" + data.GID +"&UserNickName=" + data.UserNickName;
       //     return false;
       // }
     // });
   
    return false;
}); 


function ShowTablesDatas(thisTabble){
    var dGMUserName = document.getElementById("GMUserName");
    var dUserGameID =  document.getElementById("UserGameID");
    var dBeforDateTime =  document.getElementById("BeforDateTime");
    var dAfterDateTime =  document.getElementById("AfterDateTime");
    var disabnormal =  document.getElementById("isabnormal");
    var duserWinLose =  document.getElementById("userWinLose");
    thisTabble.render({
        elem:'#userinfotable'
        ,url:'/userrecord/userrecordmailtable'
        ,where: {
                GMUserName:dGMUserName.value
                ,UserGameID: dUserGameID.value
                ,BeforDateTime:dBeforDateTime.value
                ,AfterDateTime:dAfterDateTime.value
                ,isabnormal:disabnormal.value
                ,userWinLose:duserWinLose.value
       
        }
        ,done: function(res, curr, count) {
            GetPageTitleData(res.titleinfo)
        }
        ,cols: [[ //标题栏
        
            {field:'ugameID',title:'推广号',width:120}
            ,{field:'unickname',title:'昵称',width:150}
            ,{field:'GMUserName',title:'管理员',width:150}
            ,{field:'OprateTime',title:'操作时间',width:180}
            ,{field:'GetGold',title:'邮件金币',width:120}
            ,{field:'title',title:'邮件标题',width:320}
            ,{field:'Content',title:'邮件内容',width:520}
            ,{field:'Status',title:'邮件状态',width:120}
                ]] 
        ,skin: 'row' //表格风格
        ,even: true
        ,page: true //是否显示分页
        ,limits: [50,100,200]
        ,limit: 100//每页默认显示的数量
        ,width: 'full-10'
        ,rules: 'all'
        ,height: 'full-210'
    });
}

function GetPageTitleData(titleinfo){
   // alert(JSON.stringify(titleinfo))
    if (titleinfo.length > 0)
    {
        if (titleinfo[0].MGOLD == null){
            titleinfo[0].MGOLD = 0
        }
        document.getElementById("UserData1").innerHTML = titleinfo[0].MGOLD;
        document.getElementById("UserData2").innerHTML = titleinfo[0].total;
    }
  
    return false;
 
}


</script>
</body>
</html>